#include<iostream>

class Test//内存对齐
{
public:
    Test():a(1),b(2){}
    //虚函数因为虚指针占内存，函数不占内存，函数调用靠this指针
    virtual void show()//虚指针放在内存第一个
    {
        std::cout<<"hello"<<std::endl;
    }
public:
    int a;
    char b;
   // const int c;//占内存，依赖对象
    //static int d;//静态变量不在内存中
};
class Derived:virtual public Test//因为虚继承指针占内存
{
public:
    int c;
};
int main()
{
    Derived t;
    printf("%p %p %p %p \n",&t,&t.a,&t.b,&t.c);
  
    std::cout<<sizeof(t)<<std::endl;
    return 0;
}